<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of StoryAction
 *
 * @author hujghc
 */
class StoryAction extends Action {

    public function Index() {
        $id = $_GET["id"];
        if (is_numeric($id)) {
            $story = M("story");
            $detail = $story->find($id);
            $this->assign($detail);
            $this->display();
        } else {
            $this->display();
        }
    }

    public function Save() {
        $entity = M("Story");
        $data = $entity->create();
        if ($data["id"] > 0) {
            $entity->save($data);
        } else {
            $entity->add($data);
        }
        $this->redirect("index");
//        $this->redirect('index/index', array(), 5,'页面跳转中~');
//        if(empty($_SESSION['xxx'])){
//     redirect(__APP__/Public/login);
// }
    }

}

?>
